package com.leo.foodmaster.commons.exception;

/**
 * <p>
 * 自定义基础异常
 * </p>
 *
 * @author ：Leo
 * @since ：2021-06-17 16:39
 */
public class BaseException extends RuntimeException {
    private static final long serialVersionUID = 1L;

    private Integer code;

    private String message;

    /**
     * 所属模块
     */
    private String module;

    /**
     * 错误码对应的参数
     */
    private Object[] args;

    public BaseException(String message)
    {
        this.message = message;
    }

    public BaseException(String message, Integer code) {
        this.message = message;
        this.code = code;
    }

    public BaseException(String message, Throwable e) {
        super(message, e);
        this.message = message;
    }

    public BaseException(String module, Integer code, Object[] args, String message) {
        this.module = module;
        this.code = code;
        this.args = args;
        this.message = message;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public Integer getCode() {
        return code;
    }
}
